home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / djgpp / include / x11 / xlcint.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-11  |  13.4 KB  |  584 lines

  1. /*
  2.  * $XConsortium: Xlcint.h,v 11.14 92/04/14 15:42:59 rws Exp $
  3.  */
  4.  
  5. /*
  6.  * Copyright 1990, 1991 by OMRON Corporation, NTT Software Corporation,
  7.  *                      and Nippon Telegraph and Telephone Corporation
  8.  * Copyright 1991 by the Massachusetts Institute of Technology
  9.  * Copyright 1991 by the Open Software Foundation
  10.  *
  11.  * Permission to use, copy, modify, distribute, and sell this software and its
  12.  * documentation for any purpose is hereby granted without fee, provided that
  13.  * the above copyright notice appear in all copies and that both that
  14.  * copyright notice and this permission notice appear in supporting
  15.  * documentation, and that the names of OMRON, NTT Software, NTT, Open
  16.  * Software Foundation and M.I.T. not be used in advertising or 
  17.  * publicity pertaining to distribution of the software without specific, 
  18.  * written prior permission. OMRON, NTT Software, NTT, Open Software
  19.  * Foundation and M.I.T. make no representations about the suitability of this
  20.  * software for any purpose.  It is provided "as is" without express or
  21.  * implied warranty.
  22.  *
  23.  * OMRON, NTT SOFTWARE, NTT, OPEN SOFTWARE FOUNDATION AND M.I.T. 
  24.  * DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 
  25.  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT 
  26.  * SHALL OMRON, NTT SOFTWARE, NTT, OPEN SOFTWARE FOUNDATIONN OR M.I.T. BE
  27.  * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 
  28.  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  29.  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  30.  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  31.  * 
  32.  *    Authors: Li Yuhong        OMRON Corporation
  33.  *         Tatsuya Kato        NTT Software Corporation
  34.  *         Hiroshi Kuribayashi    OMRON Coproration
  35.  *         Muneiyoshi Suzuki    Nippon Telegraph and Telephone Co.
  36.  * 
  37.  *         M. Collins        OSF  
  38.  */                
  39.  
  40.  
  41. #ifndef    _XLCINT_H_
  42. #define    _XLCINT_H_
  43.  
  44. #include <X11/Xresource.h>
  45.  
  46. /* current Ultrix compiler gets horribly confused */
  47. #if defined(FUNCPROTO) && defined(ultrix)
  48. #undef NeedFunctionPrototypes
  49. #endif
  50.  
  51. typedef struct _XIMFilter {
  52.     struct _XIMFilter *next;
  53.     Window window;
  54.     unsigned long event_mask;
  55.     int start_type, end_type;
  56.     Bool (*filter)(
  57. #if NeedFunctionPrototypes
  58.     Display*, Window, XEvent*, XPointer
  59. #endif
  60.     );
  61.     XPointer client_data;
  62. } XFilterEventRec, *XFilterEventList;
  63.  
  64. #ifdef offsetof
  65. #define XOffsetOf(s_type,field) offsetof(s_type,field)
  66. #else
  67. #define XOffsetOf(s_type,field) ((unsigned int)&(((s_type*)NULL)->field))
  68. #endif
  69.  
  70. #define XIMNumber(arr) ((unsigned int) (sizeof(arr) / sizeof(arr[0])))
  71.  
  72. typedef struct {
  73.     char    *name;
  74.     XPointer value;
  75. } XIMArg;
  76.  
  77. #define    ICInputStyle        0
  78. #define    ICClientWindow        1
  79. #define    ICFocusWindow        2
  80. #define    ICFilterEvents        3
  81. #define    ICArea            4
  82. #define    ICAreaNeeded        5
  83. #define    ICSpotLocation        6
  84. #define    ICColormap        7
  85. #define    ICStdColormap        8
  86. #define    ICForeground        9
  87. #define    ICBackground        10
  88. #define    ICBackgroundPixmap    11
  89. #define    ICFontSet        12
  90. #define    ICLineSpace        13
  91. #define    ICCursor        14
  92. #define    ICResourceClass        26
  93. #define    ICResourceName        27
  94.  
  95. #define    IMQueryInputStyle    0
  96.  
  97. #define IMResourceWrite        1
  98. #define IMResourceRead         2
  99. #define IMResourceReadWrite    3
  100.  
  101. /*
  102.  * define secondary data structs which are part of Input methods
  103.  * and input context
  104.  */
  105. typedef struct {
  106.     XrmQuark        xrm_name;        /* Resource name quark */
  107.     int            xrm_size;        /* Size in bytes of data */
  108.     long        xrm_offset;        /* -offset-1 */
  109.     unsigned short     mode;            /* Read Write Permission */
  110.     int            mask;            /* ? */
  111. } XIMrmResource, *XIMrmResourceList;
  112.  
  113. typedef struct {
  114.     char        *resource_name;        /* Resource string */
  115.     int            resource_size;        /* Size in bytes of data */
  116.     long        resource_offset;    /* -offset-1 */
  117.     unsigned short     mode;            /* Read Write Permission */
  118.     int            mask;            /* ? */
  119. } XIMResource, *XIMResourceList;
  120.  
  121. typedef struct {
  122.     XIMCallback start;
  123.     XIMCallback done;
  124.     XIMCallback draw;
  125.     XIMCallback caret;
  126. } ICCallbacks;
  127.  
  128. /*
  129.  * data block describing the visual attributes associated with
  130.  * an input context
  131.  */
  132. typedef struct {
  133.     XRectangle        area;
  134.     XRectangle        area_needed;
  135.     XPoint        spot_location;
  136.     Colormap        colormap;
  137.     Atom        std_colormap;
  138.     unsigned long    foreground;
  139.     unsigned long    background;
  140.     Pixmap        background_pixmap;
  141.     XFontSet            fontset;
  142.     int                   line_space;
  143.     Cursor        cursor;
  144.     ICCallbacks        callbacks;
  145. } ICAttributes, *ICAttributesPtr;
  146.  
  147. typedef struct _XLCd *XLCd; /* need forward reference */
  148.  
  149. /*
  150.  * define an LC, it's methods, and data.
  151.  */
  152.  
  153. typedef struct {
  154.   char* (*map_modifiers)(        /* called by XSetModifiers */
  155. #if NeedFunctionPrototypes
  156.     XLCd, char*, char*
  157. #endif
  158.     );
  159.     XFontSet (*create_fontset)(
  160. #if NeedFunctionPrototypes
  161.     XLCd, Display*, char*, char**, int, char***, int*
  162. #endif
  163.     );
  164.     XIM (*open_im)(
  165. #if NeedFunctionPrototypes
  166.     XLCd, Display*, XrmDatabase, char*, char*
  167. #endif
  168.     );
  169. } XLCdMethodsRec, *XLCdMethods;
  170.  
  171.  
  172. typedef struct {
  173.     char*        name;            /* name of this LC */
  174.     char*        modifiers;        /* modifiers of locale */
  175. } XLCdCoreRec, *XLCdCore;
  176.  
  177.  
  178. typedef struct _XLCd {
  179.     XLCdMethods        methods;        /* methods of this LC */
  180.     XLCdCoreRec        core;            /* data of this LC */
  181. } XLCdRec;
  182.  
  183.  
  184. /*
  185.  * X Font Sets are an instantiable object, so we define it, the 
  186.  * object itself, a method list and data
  187.  */
  188.  
  189. /* 
  190.  * XFontSet object method list
  191.  */
  192. typedef struct {
  193.     /* pure font methods */
  194.  
  195.     void (*free)(
  196. #if NeedFunctionPrototypes
  197.     Display*, XFontSet
  198. #endif
  199.     );
  200.     
  201.     /* multi-byte text drawing methods */
  202.  
  203.     int (*mb_escapement)(
  204. #if NeedFunctionPrototypes
  205.     XFontSet, char*, int
  206. #endif
  207.     );
  208.     int (*mb_extents)(
  209. #if NeedFunctionPrototypes
  210.     XFontSet, char*, int, XRectangle*, XRectangle*
  211. #endif
  212.     );
  213.     Status (*mb_extents_per_char)(
  214. #if NeedFunctionPrototypes
  215.     XFontSet, char*, int, XRectangle*, XRectangle*, int, int*,
  216.     XRectangle*, XRectangle*
  217. #endif
  218.     );
  219.     int (*mb_draw_string)(
  220. #if NeedFunctionPrototypes
  221.     Display*, Drawable, XFontSet, GC, int, int, char*, int
  222. #endif
  223.     );
  224.     void (*mb_draw_image_string)(
  225. #if NeedFunctionPrototypes
  226.     Display*, Drawable, XFontSet, GC, int, int, char*, int
  227. #endif
  228.     );
  229.  
  230.     /* wide character text drawing methods */
  231.  
  232.     int (*wc_escapement)(
  233. #if NeedFunctionPrototypes
  234.     XFontSet, wchar_t*, int
  235. #endif
  236.     );
  237.     int (*wc_extents)(
  238. #if NeedFunctionPrototypes
  239.     XFontSet, wchar_t*, int, XRectangle*, XRectangle*
  240. #endif
  241.     );
  242.     Status (*wc_extents_per_char)(
  243. #if NeedFunctionPrototypes
  244.     XFontSet, wchar_t*, int, XRectangle*, XRectangle*, int, int*,
  245.     XRectangle*, XRectangle*
  246. #endif
  247.     );
  248.     int (*wc_draw_string)(
  249. #if NeedFunctionPrototypes
  250.     Display*, Drawable, XFontSet, GC, int, int, wchar_t*, int
  251. #endif
  252.     );
  253.     void (*wc_draw_image_string)(
  254. #if NeedFunctionPrototypes
  255.     Display*, Drawable, XFontSet, GC, int, int, wchar_t*, int
  256. #endif
  257.     );
  258. } XFontSetMethodsRec, *XFontSetMethods;
  259.  
  260.  
  261. /*
  262.  * XFontSet LC independent data
  263.  */
  264.  
  265. typedef struct {
  266.     XLCd        lcd;            /* LC of this font set */
  267.     char *        base_name_list;         /* base font name list */
  268.     int                num_of_fonts;           /* number of fonts */
  269.     char **        font_name_list;         /* font names list */
  270.     XFontStruct **    font_struct_list;       /* font struct list */
  271.     XFontSetExtents      font_set_extents;       /* font set extents */
  272.     char *        default_string;         /* default string */
  273.     Bool        context_dependent;    /* context-dependent drawing */
  274. } XFontSetCoreRec, *XFontSetCore;
  275.  
  276.  
  277. /*
  278.  * An XFontSet.  Implementations may need to extend this data structure to
  279.  * accomodate additional data, state information etc.
  280.  */
  281. typedef struct _XFontSet {
  282.     XFontSetMethods    methods;        /* methods of this font set */
  283.     XFontSetCoreRec    core;            /* data of this font set */
  284. } XFontSetRec;
  285.  
  286.  
  287.  
  288. /*
  289.  * X Input Managers are an instantiable object, so we define it, the 
  290.  * object itself, a method list and data.
  291.  */
  292.  
  293. /*
  294.  * an Input Manager object method list
  295.  */
  296. typedef struct {
  297.     Status (*close)(
  298. #if NeedFunctionPrototypes
  299.     XIM
  300. #endif
  301.     );
  302.     char* (*get_values)(
  303. #if NeedFunctionPrototypes
  304.     XIM, XIMArg*
  305. #endif
  306.     );
  307.     XIC (*create_ic)(
  308. #if NeedFunctionPrototypes
  309.     XIM, XIMArg*
  310. #endif
  311.     );
  312. } XIMMethodsRec, *XIMMethods;
  313.  
  314. /*
  315.  * Input Manager LC independent data
  316.  */
  317. typedef struct {
  318.     XLCd        lcd;            /* LC of this input method */
  319.     XIC            ic_chain;        /* list of ICs for this IM */
  320.  
  321.     Display *        display;                   /* display */
  322.     XrmDatabase     rdb;
  323.     char *        res_name;
  324.     char *        res_class;
  325.  
  326.     XIMrmResourceList    ic_resources;        /* compiled IC resource list */
  327.     unsigned int    ic_num_resources;
  328.     XIMrmResourceList    ic_attr_resources;    /* compiled IC visual res */
  329.     unsigned int    ic_num_attr_resources;
  330. } XIMCoreRec, *XIMCore;
  331.  
  332.  
  333.  
  334. /*
  335.  * An X Input Manager (IM).  Implementations may need to extend this data 
  336.  * structure to accomodate additional data, state information etc.
  337.  */
  338. typedef struct _XIM {
  339.     XIMMethods        methods;        /* method list of this IM */
  340.     XIMCoreRec        core;            /* data of this IM */
  341. } XIMRec;
  342.  
  343.  
  344.  
  345. /*
  346.  * X Input Contexts (IC) are an instantiable object, so we define it, the 
  347.  * object itself, a method list and data for this object
  348.  */
  349.  
  350. /*
  351.  * Input Context method list
  352.  */ 
  353. typedef struct {
  354.     void (*destroy)(
  355. #if NeedFunctionPrototypes
  356.     XIC
  357. #endif
  358.     );
  359.     void (*set_focus)(
  360. #if NeedFunctionPrototypes
  361.     XIC
  362. #endif
  363.     );
  364.     void (*unset_focus)(
  365. #if NeedFunctionPrototypes
  366.     XIC
  367. #endif
  368.     );
  369.     char* (*set_values)(
  370. #if NeedFunctionPrototypes
  371.     XIC, XIMArg*
  372. #endif
  373.     );
  374.     char* (*get_values)(
  375. #if NeedFunctionPrototypes
  376.     XIC, XIMArg*
  377. #endif
  378.     );
  379.     char* (*mb_reset)(
  380. #if NeedFunctionPrototypes
  381.     XIC
  382. #endif
  383.     );
  384.     wchar_t* (*wc_reset)(
  385. #if NeedFunctionPrototypes
  386.     XIC
  387. #endif
  388.     );
  389.     int (*mb_lookup_string)(
  390. #if NeedFunctionPrototypes
  391.     XIC, XKeyEvent*, char*, int, KeySym*, Status*
  392. #endif
  393.     );
  394.     int (*wc_lookup_string)(
  395. #if NeedFunctionPrototypes
  396.     XIC, XKeyEvent*, wchar_t*, int, KeySym*, Status*
  397. #endif
  398.     );
  399. } XICMethodsRec, *XICMethods;
  400.  
  401.  
  402.  
  403. /*
  404.  * Input Context LC independent data
  405.  */
  406. typedef struct {
  407.     XIM            im;            /* XIM this IC belongs too */
  408.     XIC            next;            /* linked list of ICs for IM */
  409.  
  410.     Window        client_window;        /* window IM can use for */
  411.                         /* display or subwindows */
  412.     XIMStyle        input_style;        /* IM's input style */
  413.     Window        focus_window;        /* where key events go */
  414.     XrmDatabase        res_database;        /* where IM gets resources */
  415.     char *        string_database;    /* string for IM's resources */
  416.     XIMCallback        geometry_callback;    /* client callback */
  417.     int            preedit_state;        /*  */
  418.     unsigned long    filter_events;        /* event mask from IM */
  419.  
  420.     ICAttributes    preedit_attr;        /* visuals of preedit area */
  421.     ICAttributes    status_attr;        /* visuals of status area */
  422. } XICCoreRec, *XICCore;
  423.  
  424.  
  425. /*
  426.  * an Input Context.  Implementations may need to extend this data 
  427.  * structure to accomodate additional data, state information etc.
  428.  */
  429. typedef struct _XIC {
  430.     XICMethods        methods;        /* method list of this IC */
  431.     XICCoreRec        core;            /* data of this IC */
  432. } XICRec;
  433.  
  434. /*
  435.  * Methods for Xrm parsing
  436.  */
  437.  
  438. typedef struct {
  439.     void (*mbinit)(
  440. #if NeedFunctionPrototypes
  441.     XPointer    /* state */
  442. #endif
  443.     );
  444.     char (*mbchar)(
  445. #if NeedFunctionPrototypes
  446.     XPointer    /* state */,
  447.     char*        /* str */,
  448.     int*        /* lenp */
  449. #endif
  450.     );
  451.     void (*mbfinish)(
  452. #if NeedFunctionPrototypes
  453.     XPointer /* state */
  454. #endif
  455.     );
  456.     char* (*lcname)(
  457. #if NeedFunctionPrototypes
  458.     XPointer /* state */
  459. #endif
  460.     );
  461.     void (*destroy)(
  462. #if NeedFunctionPrototypes
  463.     XPointer /* state */
  464. #endif
  465.     );
  466. } XrmMethodsRec, *XrmMethods;
  467.  
  468. /* current Ultrix compiler gets horribly confused */
  469. #if !defined(NeedFunctionPrototypes) && defined(FUNCPROTO)
  470. #define NeedFunctionPrototypes 1
  471. #endif
  472.  
  473. typedef XLCd (*XLCdLoadProc)(
  474. #if NeedFunctionPrototypes
  475.     char*
  476. #endif
  477. );
  478.  
  479. _XFUNCPROTOBEGIN
  480.  
  481. extern XLCd _XlcCurrentLC(
  482. #if NeedFunctionPrototypes
  483.     void
  484. #endif
  485. );
  486.  
  487. extern Bool _XlcValidModSyntax(
  488. #if NeedFunctionPrototypes
  489.     char*    /* mods */,
  490.     char**    /* valid */
  491. #endif
  492. );
  493.  
  494. extern char *_XlcDefaultMapModifiers(
  495. #if NeedFunctionPrototypes
  496.     XLCd    /* lcd */,
  497.     char*    /* user_mods */,
  498.     char*    /* prog_mods */
  499. #endif
  500. );
  501.  
  502. extern void _XIMCompileResourceList(
  503. #if NeedFunctionPrototypes
  504.     XIMResourceList    /* res */,
  505.     unsigned int    /* num_res */
  506. #endif
  507. );
  508.  
  509. extern void _XCopyToArg(
  510. #if NeedFunctionPrototypes
  511.     XPointer        /* src */,
  512.     XPointer*        /* dst */,
  513.     unsigned int    /* size */
  514. #endif
  515. );
  516.  
  517. extern char ** _XParseBaseFontNameList(
  518. #if NeedFunctionPrototypes
  519.     char*        /* str */,
  520.     int*        /* num */
  521. #endif
  522. );
  523.  
  524. extern XrmMethods _XrmInitParseInfo(
  525. #if NeedFunctionPrototypes
  526.     XPointer*    /* statep */
  527. #endif
  528. );
  529.  
  530. extern void _XRegisterFilterByMask(
  531. #if NeedFunctionPrototypes
  532.     Display*        /* dpy */,
  533.     Window        /* window */,
  534.     unsigned long    /* event_mask */,
  535.     Bool (*)(
  536. #if NeedNestedPrototypes
  537.          Display*    /* display */,
  538.          Window    /* window */,
  539.          XEvent*    /* event */,
  540.          XPointer    /* client_data */
  541. #endif
  542.          )        /* filter */,
  543.     XPointer        /* client_data */
  544. #endif
  545. );
  546.  
  547. extern void _XRegisterFilterByType(
  548. #if NeedFunctionPrototypes
  549.     Display*        /* dpy */,
  550.     Window        /* window */,
  551.     int            /* start_type */,
  552.     int            /* end_type */,
  553.     Bool (*)(
  554. #if NeedNestedPrototypes
  555.          Display*    /* display */,
  556.          Window    /* window */,
  557.          XEvent*    /* event */,
  558.          XPointer    /* client_data */
  559. #endif
  560.          )        /* filter */,
  561.     XPointer        /* client_data */
  562. #endif
  563. );
  564.  
  565. extern void _XUnregisterFilter(
  566. #if NeedFunctionPrototypes
  567.     Display*        /* dpy */,
  568.     Window        /* window */,
  569.     Bool (*)(
  570. #if NeedNestedPrototypes
  571.          Display*    /* display */,
  572.          Window    /* window */,
  573.          XEvent*    /* event */,
  574.          XPointer    /* client_data */
  575. #endif
  576.          )        /* filter */,
  577.     XPointer        /* client_data */
  578. #endif
  579. );
  580.  
  581. _XFUNCPROTOEND
  582.  
  583. #endif    /* _XLCINT_H_ */
  584.